package code3;

/**
 * @author noob
 * @version 1.0
 * @date 2021/3/19 16:56
 */
public class MainTest {
    public static void main(String[] args) {


        Integer[] nums = {-2, 0, 3, -5, 2, -1};
        SegmentTree2<Integer> segTree = new SegmentTree2<>(nums, (a, b) -> (a + b));
        System.out.println(segTree.query(0, 2)); //1
        System.out.println(segTree.query(2, 5)); //-1
        System.out.println(segTree.query(0, 5));  //-3


    }
}
